home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996…eptember: Technology Seed / Mac Tech Seed Sep '96 / Mac Tech Seed Sep '96.toast / mac / QuickDraw 3D 1.5d7 / Interfaces / QD3DPick.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-23  |  8.2 KB  |  305 lines  |  [TEXT/R*ch]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DPick.h                                                 **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Public picking routines                                  **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DPick_h
  15. #define QD3DPick_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #include "QD3DStyle.h"
  22. #include "QD3DGeometry.h"
  23.  
  24. #if defined(THINK_C) || defined(__SC__)
  25.     #pragma options(!pack_enums, !align_arrays)
  26.     #pragma SC options align=power
  27. #elif defined(__MWERKS__)
  28.     #pragma enumsalwaysint on
  29.     #pragma align_array_members off
  30.     #pragma options align=native
  31. #elif defined(__PPCC__)
  32.     #pragma options align=power
  33. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  34.     #pragma options enum=int
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif  /*  __cplusplus  */
  40.  
  41.  
  42. /*****************************************************************************
  43.  **                                                                            **
  44.  **                            Mask bits for hit information                     **
  45.  **                                                                            **
  46.  *****************************************************************************/
  47.  
  48. typedef enum TQ3PickDetailMasks {
  49.     kQ3PickDetailNone                    = 0,
  50.     kQ3PickDetailMaskPickID             = 1 << 0,
  51.     kQ3PickDetailMaskPath                 = 1 << 1,
  52.     kQ3PickDetailMaskObject             = 1 << 2,
  53.     kQ3PickDetailMaskLocalToWorldMatrix    = 1 << 3,
  54.     kQ3PickDetailMaskXYZ                 = 1 << 4,
  55.     kQ3PickDetailMaskDistance             = 1 << 5,
  56.     kQ3PickDetailMaskNormal             = 1 << 6,
  57.     kQ3PickDetailMaskShapePart             = 1 << 7,
  58.     kQ3PickDetailMaskPickPart             = 1 << 8,
  59.     kQ3PickDetailMaskUV                 = 1 << 9
  60. } TQ3PickDetailMasks;
  61.  
  62. typedef unsigned long TQ3PickDetail;
  63.  
  64.  
  65. /******************************************************************************
  66.  **                                                                             **
  67.  **                                Hitlist sorting                                 **
  68.  **                                                                             **
  69.  *****************************************************************************/
  70.  
  71. typedef enum TQ3PickSort {
  72.     kQ3PickSortNone,
  73.     kQ3PickSortNearToFar,
  74.     kQ3PickSortFarToNear
  75. } TQ3PickSort;
  76.  
  77.  
  78. /******************************************************************************
  79.  **                                                                             **
  80.  **                    Data structures to set up the pick object                 **
  81.  **                                                                             **
  82.  *****************************************************************************/
  83.  
  84. #define kQ3ReturnAllHits        0
  85.  
  86. typedef struct TQ3PickData {
  87.     TQ3PickSort            sort;
  88.     TQ3PickDetail        mask;
  89.     unsigned long        numHitsToReturn;
  90. } TQ3PickData;
  91.  
  92. typedef struct TQ3WindowPointPickData {
  93.     TQ3PickData            data;
  94.     TQ3Point2D            point;
  95.     float                vertexTolerance;
  96.     float                edgeTolerance;
  97. } TQ3WindowPointPickData;
  98.  
  99. typedef struct TQ3WindowRectPickData {
  100.     TQ3PickData            data;
  101.     TQ3Area                rect;
  102. } TQ3WindowRectPickData;
  103.  
  104.  
  105. /******************************************************************************
  106.  **                                                                             **
  107.  **                                    Hit data                                 **
  108.  **                                                                             **
  109.  *****************************************************************************/
  110.  
  111. typedef struct TQ3HitPath {
  112.     TQ3GroupObject            rootGroup;
  113.     unsigned long             depth;
  114.     TQ3GroupPosition        *positions;
  115. } TQ3HitPath;
  116.  
  117. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  118.  
  119. /*
  120.  *    The following data structure has been obsoleted by
  121.  *    the Q3Pick_GetPickDetailData function in conjunction
  122.  *    with the pickDetailValue enum
  123.  */
  124.  
  125. typedef struct TQ3HitData {
  126.     TQ3PickParts            part;
  127.     TQ3PickDetail            validMask;
  128.     unsigned long             pickID;
  129.     TQ3HitPath                path;
  130.     TQ3Object                object;
  131.     TQ3Matrix4x4            localToWorldMatrix;
  132.     TQ3Point3D                xyzPoint;
  133.     float                    distance;
  134.     TQ3Vector3D                normal;
  135.     TQ3ShapePartObject        shapePart;
  136. } TQ3HitData;
  137.     
  138. #endif /* QD3D_OBSOLETE */
  139.  
  140. /******************************************************************************
  141.  **                                                                             **
  142.  **                                Pick class methods                             **
  143.  **                                                                             **
  144.  *****************************************************************************/
  145.  
  146. QD3D_EXPORT TQ3ObjectType Q3Pick_GetType(
  147.     TQ3PickObject        pick);
  148.  
  149. QD3D_EXPORT TQ3Status Q3Pick_GetData(
  150.     TQ3PickObject        pick,
  151.     TQ3PickData            *data);
  152.  
  153. QD3D_EXPORT TQ3Status Q3Pick_SetData(
  154.     TQ3PickObject        pick,
  155.     const TQ3PickData    *data);
  156.     
  157. QD3D_EXPORT TQ3Status Q3Pick_GetVertexTolerance(
  158.     TQ3PickObject        pick,
  159.     float                *vertexTolerance);
  160.     
  161. QD3D_EXPORT TQ3Status Q3Pick_GetEdgeTolerance(
  162.     TQ3PickObject        pick,
  163.     float                *edgeTolerance);
  164.     
  165. QD3D_EXPORT TQ3Status Q3Pick_SetVertexTolerance(
  166.     TQ3PickObject        pick,
  167.     float                vertexTolerance);
  168.     
  169. QD3D_EXPORT TQ3Status Q3Pick_SetEdgeTolerance(
  170.     TQ3PickObject        pick,
  171.     float                edgeTolerance);
  172.  
  173. QD3D_EXPORT TQ3Status Q3Pick_GetNumHits(
  174.     TQ3PickObject        pick,
  175.     unsigned long        *numHits);
  176.  
  177. QD3D_EXPORT TQ3Status Q3Pick_EmptyHitList(
  178.     TQ3PickObject        pick);
  179.  
  180. QD3D_EXPORT TQ3Status Q3Pick_GetPickDetailValidMask(
  181.     TQ3PickObject        pick,
  182.     unsigned long        index,
  183.     TQ3PickDetail        *pickDetailValidMask);
  184.  
  185. QD3D_EXPORT TQ3Status Q3Pick_GetPickDetailData(
  186.     TQ3PickObject        pick,
  187.     unsigned long        index,
  188.     TQ3PickDetail        pickDetailValue,
  189.     void                *detailData);
  190.  
  191. TQ3Status Q3HitPath_EmptyData(
  192.     TQ3HitPath            *hitPath);
  193.  
  194. #if defined(QD3D_OBSOLETE) && QD3D_OBSOLETE
  195.  
  196. /*
  197.  *    The following functions have been superseeded
  198.  *    by the Q3Pick_GetPickDetailData function
  199.  */
  200.  
  201. QD3D_EXPORT TQ3Status Q3Pick_GetHitData(
  202.     TQ3PickObject        pick,
  203.     unsigned long        index,
  204.     TQ3HitData            *hitData);
  205.  
  206. QD3D_EXPORT TQ3Status Q3Hit_EmptyData(
  207.     TQ3HitData            *hitData);
  208.     
  209. #endif /* QD3D_OBSOLETE */
  210.     
  211. /******************************************************************************
  212.  **                                                                             **
  213.  **                            Window point pick methods                         **
  214.  **                                                                             **
  215.  *****************************************************************************/
  216.  
  217. QD3D_EXPORT TQ3PickObject Q3WindowPointPick_New(
  218.     const TQ3WindowPointPickData    *data);
  219.  
  220. QD3D_EXPORT TQ3Status Q3WindowPointPick_GetPoint(
  221.     TQ3PickObject                    pick,
  222.     TQ3Point2D                        *point);
  223.  
  224. QD3D_EXPORT TQ3Status Q3WindowPointPick_SetPoint(
  225.     TQ3PickObject                    pick,
  226.     const TQ3Point2D                *point);
  227.  
  228. QD3D_EXPORT TQ3Status Q3WindowPointPick_GetData(
  229.     TQ3PickObject                    pick,
  230.     TQ3WindowPointPickData            *data);
  231.  
  232. QD3D_EXPORT TQ3Status Q3WindowPointPick_SetData(
  233.     TQ3PickObject                    pick,
  234.     const TQ3WindowPointPickData    *data);
  235.  
  236.  
  237. /******************************************************************************
  238.  **                                                                             **
  239.  **                            Window rect pick methods                         **
  240.  **                                                                             **
  241.  *****************************************************************************/
  242.  
  243. QD3D_EXPORT TQ3PickObject Q3WindowRectPick_New(
  244.     const TQ3WindowRectPickData    *data);
  245.  
  246. QD3D_EXPORT TQ3Status Q3WindowRectPick_GetRect(
  247.     TQ3PickObject                pick,
  248.     TQ3Area                        *rect);
  249.  
  250. QD3D_EXPORT TQ3Status Q3WindowRectPick_SetRect(
  251.     TQ3PickObject                pick,
  252.     const TQ3Area                *rect);
  253.  
  254. QD3D_EXPORT TQ3Status Q3WindowRectPick_GetData(
  255.     TQ3PickObject                pick,
  256.     TQ3WindowRectPickData        *data);
  257.  
  258. QD3D_EXPORT TQ3Status Q3WindowRectPick_SetData(
  259.     TQ3PickObject                pick,
  260.     const TQ3WindowRectPickData    *data);
  261.  
  262. /******************************************************************************
  263.  **                                                                             **
  264.  **                                Shape Part methods                             **
  265.  **                                                                             **
  266.  *****************************************************************************/
  267.  
  268. QD3D_EXPORT TQ3ObjectType Q3ShapePart_GetType(
  269.     TQ3ShapePartObject            shapePartObject);
  270.  
  271. QD3D_EXPORT TQ3ObjectType Q3MeshPart_GetType(
  272.     TQ3MeshPartObject            meshPartObject);
  273.  
  274. QD3D_EXPORT TQ3Status Q3ShapePart_GetShape(
  275.     TQ3ShapePartObject            shapePartObject,
  276.     TQ3ShapeObject                *shapeObject);
  277.  
  278. QD3D_EXPORT TQ3Status Q3MeshPart_GetComponent(
  279.     TQ3MeshPartObject            meshPartObject,
  280.     TQ3MeshComponent            *component);
  281.  
  282. QD3D_EXPORT TQ3Status Q3MeshFacePart_GetFace(
  283.     TQ3MeshFacePartObject        meshFacePartObject,
  284.     TQ3MeshFace                    *face);
  285.  
  286. QD3D_EXPORT TQ3Status Q3MeshEdgePart_GetEdge(
  287.     TQ3MeshEdgePartObject        meshEdgePartObject,
  288.     TQ3MeshEdge                    *edge);
  289.  
  290. QD3D_EXPORT TQ3Status Q3MeshVertexPart_GetVertex(
  291.     TQ3MeshVertexPartObject        meshVertexPartObject,
  292.     TQ3MeshVertex                *vertex);
  293.  
  294. #ifdef __cplusplus
  295. }
  296. #endif  /*  __cplusplus  */
  297.  
  298. #if defined(__MWERKS__)
  299.     #pragma enumsalwaysint reset
  300. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  301.     #pragma options enum=reset
  302. #endif
  303.  
  304. #endif  /*  QD3DPick_h  */
  305.